package org.migsoft.id3lib.stringdecoders;

import java.io.UnsupportedEncodingException;

import org.migsoft.id3lib.StringDecoder;

public class EncodingDecoder implements StringDecoder{
  private final String encoding;

  public EncodingDecoder(String encoding) {
    this.encoding = encoding;
  }

  @Override
  public String decode(byte[] bs) {
    try {
      return new String(bs, encoding);
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
      throw new RuntimeException(e);
    }
  }

}
